package com.flying.pas.security.model;

import java.util.Date;

import com.flying.framework.annotation.Param;
import com.flying.framework.annotation.ServiceField;
import com.flying.framework.annotation.ServiceFieldParam;
import com.flying.framework.data.Data;
import com.flying.framework.data.DataSerializable;
import com.flying.framework.metadata.Meta;

@SuppressWarnings("serial")
@Meta(id="t_role_perm",title="", table="t_role_perm", primaryKeys={"perm_id","role_id"})
public class RolePerm extends Data implements DataSerializable {
	public final static String ENTITY_NAME = "t_role_perm";
	
	public final static String CREATE_TIME = "create_time";
	public final static String PERM_ID = "perm_id";
	public final static String ROLE_ID = "role_id";
	
	
	@Param(value=CREATE_TIME,   required=false,   maxlength=0,	desc="CREATE TIME" )
	private Date createTime;
	
	@Param(value=PERM_ID,   required=true,   maxlength=0,	desc="权限ID")
	private Long permId;
	
	@Param(value=ROLE_ID,   required=true,   maxlength=0,	desc="角色ID")
	private Long roleId;
	
	@ServiceField(serviceId="PermService:findById", params={@ServiceFieldParam(param=Perm.PERM_ID, value="$"+PERM_ID)})
	@Param(value="perm",  desc="权限" )
	private Perm perm;
	
	
	public Date getCreateTime() {
		return this.createTime;
	}
	
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
	
	public Long getPermId() {
		return this.permId;
	}
	
	public void setPermId(Long permId) {
		this.permId = permId;
	}
	
	public Long getRoleId() {
		return this.roleId;
	}
	
	public void setRoleId(Long roleId) {
		this.roleId = roleId;
	}

	public Perm getPerm() {
		return perm;
	}

	public void setPerm(Perm perm) {
		this.perm = perm;
	}
	
	public String getPermName() {
		Perm p = this.getPerm();
		return p == null?null: p.getName();
	}

}